package com.example.concurrency.thread02_strategy;

/**
 * @description:
 * @program: demos
 * @author: dove
 * @date: 2020-12-03 23:18
 * 模拟runnable的思想
 **/

public class Test {

    public static void main(String[] args) {
        // 策略模式的奥义就是把对象本身和运算规则进行分离
        // 如果策略类超过四个就要考虑换其他模式了
        Traveler traveler = new Traveler();
        traveler.setTravelStrategy(new CarStrategy());
//        traveler.setTravelStrategy(new TrainStrategy());
//        traveler.setTravelStrategy(new PlaneStrategy());
        traveler.travelMethod();
    }
}
